import socket 



if __name__ == '__main__':
    address = ('', 2020)  
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(address)
    s.listen(5)  
      
    ss, addr = s.accept()  
    print 'got connected from',addr  

    while (1):
        frame = ss.recv(5)
        print frame

        
        if frame.find('1100')!=-1:
            #frame='A2000321543215612\r'
            frame='A28C229582965023D21652A3610555555000001010102012A00EE29E11C3A0D4F015A016D147A\r'
        else:
            #frame='BF20013218510a317\r'
            frame='BE314E324E395E354E315E328E30479997277E317E327E328E344E313E007E328E3150502E417\r'
        ss.send(frame)
    

        
    print 'end'